package com.example.fontposition.dao.search;

import cn.tedu.zhaopin.protocol.position.vo.PositionSimpleVO;
import com.example.fontposition.pojo.po.PositionPO;
import org.springframework.data.domain.Pageable;
import org.springframework.data.elasticsearch.annotations.Highlight;
import org.springframework.data.elasticsearch.annotations.HighlightField;
import org.springframework.data.elasticsearch.annotations.HighlightParameters;
import org.springframework.data.elasticsearch.annotations.Query;
import org.springframework.data.elasticsearch.core.SearchPage;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface PositionElasticsearchRepository extends ElasticsearchRepository<PositionSimpleVO, Long> {
    // 自定义搜索
    @Query("{\n" +
            "    \"bool\": {\n" +
            "      \"should\": [\n" +
            "        {\n" +
            "          \"match\": {\n" +
            "            \"title\": \"?0\"\n" +
            "          }\n" +"},"+
            "        {\n" +
            "          \"match\": {\n" +
            "            \"jobType\": \"?0\"\n" +
            "          }\n"+
            "        }\n" +
            "      ]\n" +
            "    }\n" +
            "  }")
    SearchPage<PositionSimpleVO> customSearch(String title, Pageable pageable);


}
